<?php
/*
 *  Archivo inicial, el que joomla ejecuta primero 
 *
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
*/
defined( '_JEXEC' ) or die( 'Restricted access' );

require_once(JPATH_COMPONENT.DS.'controller.php');

//incluyo las tablas del lado del front-end
JTable::addIncludePath(JPATH_COMPONENT.DS.'tables');

//
//$doc =& JFactory::getDocument();
//$doc->addStyleSheet( 'components/com_reghs/reghs.css' );


//echo '<div class="componentheading">Sistema REGHS</div>';

// Create the controller
$controller = new ReghsController();
//controlo que el usuario esta logeado sino redirecciono
$usuario =& JFactory::getUser();
$miID = $usuario->get('id');

if ($miID == 0) {
    $link = JRoute::_( 'index.php?option=com_user&view=login');
    $controller->setRedirect($link);
    $controller->redirect();
}

// Perform the Request task
$task = JRequest::getVar('task');
if ($task) {
    $controller->execute($task);
} else {
    $controller->display();
}

$controller->redirect();

//$controller->execute(JRequest::getVar('task'));

$doc =& JFactory::getDocument();
$doc->addStyleSheet( 'components/com_reghs/reghs.css' );
?>

